package unidad6;

import java.text.DecimalFormat;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.text.NumberFormat;
import java.util.Locale;

public class ProbandoFormatos {
	
	public static void main(String [] args)throws Exception{

	//Un poquito con fechas y horas
	Calendar calendar = Calendar.getInstance();
	
	System.out.println(calendar.get(Calendar.DATE));
	System.out.println(calendar.get(Calendar.MONTH));
	System.out.println(calendar.get(Calendar.HOUR));
	System.out.println(calendar.get(Calendar.MINUTE));
	System.out.println(calendar.get(Calendar.SECOND));
	
	//Un poquito con ++++++ fechas
	
	Date date = new Date();
	DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
	System.out.println(df.parse("12/11/1987"));
	System.out.println(df.format(date));
	
	
	//Un poquito con formatos numericos
	
	NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);	
	System.out.println("English Format "+nf.format(4588.25));	
	
	Locale.setDefault(Locale.CHINA);	
	DecimalFormat def = new DecimalFormat("####.00");
	System.out.println(def.format(15.0));
	
	
	System.out.println(nf.getPercentInstance().format(0.47));
	
	}
	
		
		
}
	

	

